package LibraryManagementSystem.impl;

import LibraryManagementSystem.IOperation;
import LibraryManagementSystem.book.Bookcase;

/**
 * @author : niu niu
 * @version : 1.0.0
 * @date : 2022/10/22 8:09
 */
public class UpdateOperation implements IOperation {
    @Override
    public void work(Bookcase bookcase) {
        System.out.println("您正在进行书籍更新操作");
        System.out.println("请输入要更新的书籍名称:");
        String bookName = scanner.next();
        if(bookcase.findBooks(bookName)){
            System.out.println("请输入要修改的价格:");
            double price = scanner.nextDouble();
            System.out.println("请输入要修改的类型:");
            String type = scanner.next();
            bookcase.updateBook(bookName,price,type);
            System.out.println("更新成功！");
        }else {
            System.out.println("没有找到这本书哦，请检查书名！");
        }
    }
}
